home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.Container;
- import java.awt.Graphics;
- import java.awt.Rectangle;
- import java.awt.Shape;
- import javax.swing.JComponent;
- import javax.swing.text.AttributeSet;
- import javax.swing.text.BadLocationException;
- import javax.swing.text.Document;
- import javax.swing.text.Element;
- import javax.swing.text.Position;
- import javax.swing.text.View;
- import javax.swing.text.ViewFactory;
-
- class BasicHTML$Renderer extends View {
- private int width;
- private View view;
- private ViewFactory factory;
- private JComponent host;
-
- BasicHTML$Renderer(JComponent var1, ViewFactory var2, View var3) {
- super((Element)null);
- this.host = var1;
- this.factory = var2;
- this.view = var3;
- this.view.setParent(this);
- this.setSize(this.view.getPreferredSpan(0), this.view.getPreferredSpan(1));
- }
-
- public float getAlignment(int var1) {
- return this.view.getAlignment(var1);
- }
-
- public AttributeSet getAttributes() {
- return null;
- }
-
- public Container getContainer() {
- return this.host;
- }
-
- public Document getDocument() {
- return this.view.getDocument();
- }
-
- public Element getElement() {
- return this.view.getElement();
- }
-
- public int getEndOffset() {
- return this.view.getEndOffset();
- }
-
- public float getMaximumSpan(int var1) {
- return (float)Integer.MAX_VALUE;
- }
-
- public float getMinimumSpan(int var1) {
- return this.view.getMinimumSpan(var1);
- }
-
- public float getPreferredSpan(int var1) {
- return var1 == 0 ? (float)this.width : this.view.getPreferredSpan(var1);
- }
-
- public int getStartOffset() {
- return this.view.getStartOffset();
- }
-
- public View getView(int var1) {
- return this.view;
- }
-
- public int getViewCount() {
- return 1;
- }
-
- public ViewFactory getViewFactory() {
- return this.factory;
- }
-
- public Shape modelToView(int var1, Shape var2, Position.Bias var3) throws BadLocationException {
- return this.view.modelToView(var1, var2, var3);
- }
-
- public Shape modelToView(int var1, Position.Bias var2, int var3, Position.Bias var4, Shape var5) throws BadLocationException {
- return this.view.modelToView(var1, var2, var3, var4, var5);
- }
-
- public void paint(Graphics var1, Shape var2) {
- Rectangle var3 = var2.getBounds();
- this.view.setSize((float)var3.width, (float)var3.height);
- this.view.paint(var1, var2);
- }
-
- public void preferenceChanged(View var1, boolean var2, boolean var3) {
- this.host.revalidate();
- }
-
- public void setParent(View var1) {
- throw new Error("Can't set parent on root view");
- }
-
- public void setSize(float var1, float var2) {
- this.width = (int)var1;
- this.view.setSize(var1, var2);
- }
-
- public int viewToModel(float var1, float var2, Shape var3, Position.Bias[] var4) {
- return this.view.viewToModel(var1, var2, var3, var4);
- }
- }
-